﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="/Scripts/jquery-3.3.1.js"></script>
    <script>
        $(function () {
            $("#btn_login").click(function () {
                $.ajax({
                    type: "get",
                    url: "http://localhost:27221/api/User/Login",
                    data: { strUser: $("#txt_username").val(), strPwd: $("#txt_password").val() },
                    success: function (data, status) {
                        if (status == "success") {
                            if (!data.bRes) {
                                alert("登录失败");
                                return;
                            }
                            alert("登录成功");
                            localStorage.setItem("userData_Ticket", data.Ticket);
                            localStorage.setItem("userData_UserName", data.UserName);
                            window.location = "/Index.html"; 
                        }
                    },
                    error: function (e) {
                    },
                    complete: function () {

                    }

                });
            });
        });
    </script>

</head>
<body>
    <div style="text-align:center;">
        <div>用户名：<input type="text" id="txt_username" value="bruke" /></div>
        <div>密  码：<input type="password" id="txt_password" value="123" /></div>
        <div><input type="button" value="登录" id="btn_login" class="btn-default" /></div>
    </div>
</body>
</html>